package com.xj.demo.classcommand;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class TryCatchTest {
    public void method1(){
        try {
            File file = new File("a.txt");
            FileInputStream fis = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static String method2(){
        String str = "method2";
        try{
            return str;
        }finally {
            str = "hello";
        }
    }
    public static int method3(){
        int num = 10;
        try{
            return num;
        }finally {
            num = 20;
        }
    }
    public static void main(String[] args) {
        System.out.println(method2());
    }
}
